package com.fengye.middleware.rabbitmq.boot.controller;

import com.fengye.middleware.rabbitmq.boot.messageType.EventInfo;
import com.fengye.middleware.rabbitmq.boot.messageType.direct.DirectPublisher;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试exchange消息模型
 * @author sky
 * @date 2021/06/10 21:18
 */
@RestController
@Slf4j
@RequestMapping("/exchange")
public class ExchangeController {

    @Autowired
    private DirectPublisher directPublisher;

    @GetMapping("/direct/1")
    public void directOne() {
        EventInfo info = new EventInfo(1, "directOne", "directOne", "发送direct消息到1");
        directPublisher.sendObjectMsgOne(info);
    }

    @GetMapping("/direct/2")
    public void directTwo() {
        EventInfo info = new EventInfo(2, "directTwo", "directTwo", "发送direct消息到2");
        directPublisher.sendObjectMsgTwo(info);
    }
}
